import java.util.*;

public class _2023_10_24 {
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        StringBuilder str = new StringBuilder(s);
        System.out.println(str.reverse().toString());
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.next();
        char[] s1 = str1.toCharArray();
        String str2 = sc.next();
        int ans = Integer.MIN_VALUE;
        for(int l = 0; l < s1.length; l++){
            for(int r = l + 1; r <= s1.length; r++){
                String subStr = new String(s1, l , r - l);
                System.out.println(subStr);
                if(str2.contains(subStr)){
                    ans = Math.max(ans, subStr.length());
                }
            }
        }
        System.out.println(ans);
    }
}
